﻿
@Html.Script("~/scripts/Libs/kindleditor/kindeditor.js")
@Html.Script("~/scripts/Libs/kindleditor/lang/zh_CN.js")
@Html.Stylesheet("~/scripts/Libs/kindleditor/themes/default/default.css")

<script type="text/javascript">
    $(document).ready(function () {
        KindEditor.ready(function (K) {
            var uploadbutton = K.uploadbutton({
                button: K('#uploadButton')[0],
                fieldName: 'imgFile',
                url: AC_ROOT_DIR + '/users/uploadfile',
                afterUpload: function (data) {
                    if (data.error === 0) {
                        var url = K.formatUrl(data.url, 'absolute');
                        K('#photo').val(url);
                    } else {
                        alert(data.message);
                    }
                },
                afterError: function (str) {
                    alert('自定义错误信息: ' + str);
                }
            });
            uploadbutton.fileBox.change(function (e) {
                uploadbutton.submit();
            });
        });
 
    });
</script>